package com.playtime.layouts.example1;

import javafx.fxml.JavaFXBuilderFactory;
import javafx.scene.layout.HBox;
import javafx.util.Builder;
import javafx.util.BuilderFactory;

public class CustomBuilderFactory implements BuilderFactory {

    private BuilderFactory baseFactory;

    public CustomBuilderFactory() {
        baseFactory = new JavaFXBuilderFactory();
    }

    @Override
    public Builder<?> getBuilder(Class<?> aClass) {
        if (HBox.class.equals(aClass)) {
            return new CustomHBoxBuilder();
        } else {
            return baseFactory.getBuilder(aClass);
        }
    }
}
